|
|
|
|
|
|
|
Add a command button to the project. Set its Name property to cmdMakeUDP and its Caption property to MakeUDP. Add the code in Listing 9.13 to the cmdMakeUDP_Click window. |
|
|
|
|
|
|
|
|
Listing 9.13. Coding the cmdMakeUDP_Click event. |
|
|
|
|
|
|
|
|
Private Sub cmdMakeUDP_Click()
'
' add user-defined properties
'
On Error Resume Next
'
Dim ws As Workspace
Dim db As Database
Dim pr As Property
Dim prTemp As Property
'
Dim strDBName As String
Dim strUDPName As String
Dim intUDPType As Integer
Dim varUDPValue As Variant
Dim strMsg As String
'
' init vars
strDBName = App.Path & "\CreateDBOne.mdb"
'
' open ws and db
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
'
' add first UDP
strUDPName = "DBAdmin"
intUDPType = dbText
varUDPValue = "D.B. Guru"
'
db.Properties.Delete strUDPName
Set pr = db.CreateProperty(strUDPName, intUDPType, varUDPValue)
db.Properties.Append pr
'
' add second UDP
strUDPName = "Programmer"
intUDPType = dbText
varUDPValue = "V.B. Coder"
'
db.Properties.Delete strUDPName
Set pr = db.CreateProperty(strUDPName)
pr.Type = intUDPType
pr.Value = varUDPValue
db.Properties.Append pr
'
' now show results |
|
|
|
|
|